Skip to content

add account and round (group) pnl#280

Draft
crthpl wants to merge 7 commits intomainfrom
theo/arb-27-various-pnl-trackers
Draft

add account and round (group) pnl#280
crthpl wants to merge 7 commits intomainfrom
theo/arb-27-various-pnl-trackers

Conversation

@crthpl
Copy link
Copy Markdown
Contributor

@crthpl crthpl commented Dec 27, 2025

resolves ARB-97 ARB-96

@crthpl crthpl requested a review from a team as a code owner December 27, 2025 01:16
@vercel
Copy link
Copy Markdown

vercel bot commented Dec 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
platform Error Error Jan 26, 2026 1:28am
platform-team-allocation Ready Ready Preview, Comment Jan 26, 2026 1:28am

Request Review

Resolve conflicts by keeping both:
- Round PnL display from this branch
- Login page auth check and clock features from main

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
crthpl and others added 3 commits January 25, 2026 17:06
- Add optional pnl field to MarketGroup proto
- Add get_group_pnls() to calculate PnL per group for an account
- Send group PnL when sending MarketGroups to clients
- Update frontend to use backend-provided PnL instead of calculating from trade history
- Remove trade history fetching for group PnL calculation
- Hide redeem button when market is settled
- Rename "Exchange for" to "Exchangeable for"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace correlated subquery for last trade price with CTEs using
GROUP BY to avoid per-row subquery execution.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Benchmark showed the CTE approach is actually slower:
- With index: 24ms (old) vs 29ms (CTE)
- Without index: 28ms (old) vs 48ms (CTE)

The correlated subquery is more efficient because it only looks up
last trades for markets with group_id > 0, while the CTE scans all
trades upfront.

This reverts commit ed4e7f0.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant